package com.zytool.easyrestful.core.utils;

import lombok.SneakyThrows;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class ClassUtil {

    @SneakyThrows
    public static Class getGenericClass(Class clazz) {
        Type type = clazz.getGenericSuperclass();
        Type actualType = ((ParameterizedType) type).getActualTypeArguments()[0];
        return Class.forName(actualType.getTypeName());
    }
}
